// 该文件是用于打包的入口文件

/* import the fontawesome core */
import { library } from '@fortawesome/fontawesome-svg-core'

/* import font awesome icon component */
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'

/* import all icons */
import { fas } from '@fortawesome/free-solid-svg-icons'

/* add icons to the library */
library.add(fas)

// 引入样式
import './styles/index.scss'

// 引入自定义组件
import Icon from './components/Icon'
import Button from './components/Button'
import Card from './components/Card'
import Dialog from './components/Dialog'
import Pager from './components/Pager'
import Collapse from './components/Collapse'
import CollapseItem from './components/Collapse/CollapseItem'
import Tooltip from './components/Tooltip'
import Dropdown from './components/Dropdown'

// 提供一个 install 方法
const componentsArr = [
  Icon,
  Button,
  Card,
  Dialog,
  Pager,
  Collapse,
  CollapseItem,
  Tooltip,
  Dropdown,
]

// 全局注册
const install = app => {
  // 遍历注册所有的组件
  componentsArr.forEach(component => {
    app.component(component.name, component)
  })

  // 另外还有一个组件要单独zhuce
  app.component('font-awesome-icon', FontAwesomeIcon)
}

// 导出
export default {
  install,
}

// 按需导出
export {
  install,
  Icon,
  Button,
  Card,
  Dialog,
  Pager,
  Collapse,
  CollapseItem,
  Tooltip,
  Dropdown,
}
